import request from "@/util/http";

// 获取物品列表
export function getItemList() {
  return request({
    url: 'api/Item_api',
    method: 'get',
    headers: {
      token: localStorage.getItem('token')
    },
  })
}

export const getItemById = (id) => {
  return request({
    url: `/api/Item_api/${id}`,
    method: 'get',
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    },
  });
};

// 删除物品记录
export function deleteItem(data) {
  return request({
    url: `api/Item_api`,
    method: 'delete',
    data,
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    },
  });
}

// 更新物品记录
export function updateItem(data) {
  return request({
    url: `api/Item_api`,
    method: 'put',
    data,
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    },
  });
}

// 添加物品记录
export function addItem(data) {
  return request({
    url: `api/Item_api`,
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/json',
      'token': localStorage.getItem('token')
    },
  });
}

